<?php 

    $conn = oci_connect("hospital", "hospital", "//localhost/XE"); 
	$pull = oci_parse($conn, "select * from add_to
			where med_id = '$_GET[id]'");
	oci_execute($pull);

        $patid = oci_fetch_array($pull,OCI_BOTH);
        
        echo $patid['MEDICATION_ID'];
        $p = $patid['MEDICATION_ID'];
        
        if($p!=null){
           $delpa = oci_parse($conn, "delete from add_to where med_id = '$p'");
           oci_execute($delpa); 
        }
           $del1 = oci_parse($conn, "delete from add_to where std_id = '$_GET[id]'");
           oci_execute($del1);

 ?>
 
<HTML>
 <head><meta http-equiv="refresh" content="1; URL=main.php"></head>
 <BODY>
 Going Back to the table
 </BODY>
 </HTML>
